package net.taviscaron.drivenotes.web.forward;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Redirect
 * @author Andrei Senchuk
 */
public class Redirect implements RequestForwarder {
    private String path;

    public Redirect(String path) {
        this.path = path;
    }

    public String getPath() {
        return path;
    }

    public void forward(HttpServletRequest request,
            HttpServletResponse response) throws ServletException, IOException {
        response.sendRedirect (request.getContextPath () + path);
    }
}
